package com.hxb.example.service.impl;

import com.hxb.example.mapper.XxlJobLogReportMapper;
import com.hxb.example.model.XxlJobLogReportVo;
import com.hxb.example.service.XxlJobLogReportService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.hxb.example.entity.XxlJobLogReport;
import org.springframework.stereotype.Service;

/**
 *  服务层实现。
 *
 * @author HXB
 * @since 2024-05-08
 */
@Service
public class XxlJobLogReportServiceImpl extends ServiceImpl<XxlJobLogReportMapper, XxlJobLogReport> implements XxlJobLogReportService {

    @Override
    public XxlJobLogReportVo queryLogReportTotal() {
        QueryWrapper wrapper = QueryWrapper.create(XxlJobLogReport.class)
                .select("SUM(running_count) runningCount", "SUM(suc_count) sucCount", "SUM(fail_count) failCount");
        return this.getOneAs(wrapper, XxlJobLogReportVo.class);
    }
}
